# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=intel-gmmlib
pkgver=20.2.4
pkgrel=0
pkgdesc="Intel Graphics Memory Management Library"
options="!check"
url="https://github.com/intel/gmmlib/"
arch="x86_64 x86"
license="MIT"
makedepends="cmake"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/intel/gmmlib/archive/intel-gmmlib-$pkgver.tar.gz"
builddir="$srcdir/gmmlib-intel-gmmlib-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-Wno-dev \
		-DRUN_TEST_SUITE=OFF \
		$CMAKE_CROSSOPTS .
	make -C build
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="398acc4fe366d5c1c0d6b6c5f64494bd27905285985e878ecb4a4a51af585cb54fab9500c35f106f40ecc7a048fec1fbcd8cc3978ae5170a3a594dbdc5da448a  intel-gmmlib-20.2.4.tar.gz"
